v=`node --version | awk -F'.' '{print $1}'`
if [ ! "$v" = "v16" ]
then
  echo need use node 16
  exit
fi

npm run build

echo create v.html by git log

echo "<html>" > dist/v.html
echo "<head>" >> dist/v.html
echo "<meta name=\"color-schema\" content=\"light dark\">" >> dist/v.html
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" >> dist/v.html
echo "</head>" >> dist/v.html
echo "<body>" >> dist/v.html
echo "<pre style=\"word-wrap: break-word; white-space: pre-wrap;\">" >> dist/v.html
l=`git status -s |grep -v "??"`
if [ "$l" != "" ]
then
echo "!!!! 本地未提交变动 !!!!" >> dist/v.html
git status -s |grep -v "??" >> dist/v.html
echo
echo
echo ==============================
echo ==== 有未提交变动！
echo ==============================
echo
echo
fi

l=`git log --branches --not --remotes`
if [ "$l" != "" ]
then
echo >> dist/v.html
echo "!!!! 本地未推送提交 !!!!" >> dist/v.html
git log --branches --not --remotes >> dist/v.html
echo
echo
echo ==============================
echo ==== 有未推送提交！
echo ==============================
echo
echo
fi

echo >> dist/v.html
echo "---- 编译环境 ----" >> dist/v.html
date >> dist/v.html
uname -a >> dist/v.html
echo "node "`node -v` >> dist/v.html
echo "npm "`npm -v` >> dist/v.html

echo >> dist/v.html
echo "---- git提交历史 ----" >> dist/v.html
git log >> dist/v.html

echo "</pre>" >> dist/v.html
echo "</body>" >> dist/v.html
echo "</html>" >> dist/v.html

